// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

import Mint from 'mint-ui';
import 'mint-ui/lib/style.css'
Vue.use(Mint);

Vue.config.productionTip = false

Vue.filter("formDate",function(time){
	
		var d=new Date(time);
		var now=new Date();
		var t=Math.floor((now-d)/1000/60/60)
		if(t<1){
			return "刚刚";
		}else if(t<24){
			return t+"小时前";
		}else if(t>=24){
			if(t>=(30*24)){
				t=Math.floor(t/24/30);
				return t+"个月前";
			}else{
				t=Math.floor(t/24);
				return t+"天前";
			}
		}
  		
  		
})
Vue.filter("upcase",function(str){
	
		var d=str.toUpperCase();
  		return d;
  		
})
Vue.filter("imgdata",function(str){
	
		var d="http://dshsagd/"+str;
  		return d;
  		
})
Vue.filter("numform",function(num){
	 var num = (num || 0).toString(), re = /\d{3}$/, result = '';
     while ( re.test(num) ) {
         result = RegExp.lastMatch + result;
         if (num !== RegExp.lastMatch) {
             result = ',' + result;
             num = RegExp.leftContext;
         } else {
             num = '';
             break;
         }
     }
     if (num) { result = num + result; }
     return result;

})
/* eslint-disable no-new */
//Vue.prototype.$http=axios;

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
